#include "game.h"
#include <bits/stdc++.h>

using namespace std;

// #define LOCK_GETCHAR
// #define USE_INT_128

#if __cplusplus < 201400
#warning "Please use c++14 or higher."
#define CONSTEXPR_FUNC
#define ENABLE_IF_INT
#else
#define CONSTEXPR_FUNC constexpr
#define ENABLE_IF_INT , enable_if_t<_is_integer<T>, int> = 0
template <class T> constexpr bool _is_integer = numeric_limits<T>::is_integer;
template <> constexpr bool _is_integer<bool> = false;
template <> constexpr bool _is_integer<char> = false;
#ifdef USE_INT_128
template <> constexpr bool _is_integer<__int128> = true;
template <> constexpr bool _is_integer<__uint128_t> = true;
#endif
#endif

#if !defined(_WIN32) && !defined(LOCK_GETCHAR)
#define getchar getchar_unlocked
#endif

#define il inline
#define mkp make_pair
#define fi first
#define se second
#define For(i, j, k) for (decltype(j - k) i = (j); i <= (k); ++i)     // NOLINT
#define ForDown(i, j, k) for (decltype(j - k) i = (j); i >= (k); --i) // NOLINT
#define eb emplace_back
#ifndef ONLINE_JUDGE
#define FileIO(filename)                                                       \
  freopen(filename ".in", "r", stdin);                                         \
  freopen(filename ".out", "w", stdout)
#else
#define FileIO(filename) void(0)
#endif

using ll = long long;
using uint = unsigned int;
using ull = unsigned long long;
using db = double;
using ldb = long double;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
#ifdef USE_INT_128
using lll = __int128_t;
using ulll = __uint128_t;
#endif

// clang-format off
CONSTEXPR_FUNC il ll qpow(ll x, ull y, ll mod){ ll ans = 1; x %= mod; while (y) { if (y & 1) (ans *= x) %= mod; (x *= x) %= mod; y >>= 1; } return ans; }
template<typename T> CONSTEXPR_FUNC il void cmin(T & x, const T &y){ x = min(x, y); }
template<typename T> CONSTEXPR_FUNC il void cmax(T & x, const T &y){ x = max(x, y); }
template<typename T ENABLE_IF_INT> il void read(T &x){ x = 0; int f = 1; int c = getchar(); while (!isdigit(c)) { if (c == '-') f = -1; c = getchar(); } while (isdigit(c)) { x = x * 10 + c - '0'; c = getchar(); } x *= f; }
il void read(string &s) { s = ""; char ch = getchar(); while (isspace(ch)) ch = getchar(); while (!isspace(ch)) s += ch, ch = getchar(); }
il void read(char *s) { int ch = getchar(), p = 0; while (isspace(ch)) ch = getchar(); while (!isspace(ch)) s[p++] = ch, ch = getchar(); }
template<typename T, typename ... Args> il void read(T &x, Args &... y){ read(x), read(y...); }
// clang-format on

// File head end

vector<int> guess(int n, int limit) {
  vector<int> q(n);
  vector<bool> ok(n, 0);
  iota(q.begin(), q.end(), 1);
  int cur = n - count(q);
  For(i, 0, n - 1) {
    if (ok[i])
      continue;
    vector<int> pos;
    For(j, i + 1, n - 1) {
      swap(q[i], q[j]);
      int tmp = n - count(q);
      if (tmp == cur - 2) {
        cur = tmp;
        ok[i] = ok[j] = 1;
        break;
      } else if (tmp == cur - 1) {
        pos.eb(j);
      }
      swap(q[i], q[j]);
    }

    assert(pos.empty() || pos.size() == 2);

    if (pos.size() == 2) {
      swap(q[i], q[pos[0]]);
      swap(q[pos[0]], q[pos[1]]);
      int tmp = n - count(q);
      if (tmp < cur - 1)
        cur = tmp, ok[i] = ok[pos[1]] = 1;
      else {
        swap(q[pos[0]], q[pos[1]]);
        swap(q[i], q[pos[0]]);
        swap(q[i], q[pos[1]]);
        swap(q[pos[1]], q[pos[0]]);
        tmp = n - count(q), assert(tmp < cur - 1);
        cur = tmp, ok[i] = ok[pos[0]] = 1;
      }
    }
  }
  return q;
}